<template>
  <div id="app">
    <router-view/>
    <FooterGuide v-show="$route.meta.showFooterGuide"/>
  </div>
</template>

<script>
import { getUserInfoApi } from "@/api/Login/index.js"
export default {
  name: 'App',
  mounted() {
    // 每次用户执行刷新操作时，自动获取用户信息，完成自动登录
    this.getUserInfo()
  },
  methods: {
     async getUserInfo() {
      const res = await getUserInfoApi()
      if(res.status === 200) {
        let userInfo = localStorage.getItem('userInfo')
        userInfo = userInfo ? JSON.parse(userInfo) : {}

        this.$store.commit('SET_USERINFO', {
          ...res.data.data,
          ...userInfo
        })
      }
    }
  }
}
</script>

<style lang="scss">
</style>
